﻿package ${clazz.package.name}
{
<#if importClassNameList ??><#list importClassNameList as t>	import ${t};
</#list></#if>

	[Bindable]
	[RemoteClass(alias="${clazz.name}")]

	public class ${clazz.simpleName} extends Enum
	{
		/* static init */
		{ initEnum(${clazz.simpleName}); }

		/* Constants */
<#if clazz.enumConstants ? exists><#list clazz.enumConstants as enumConstant>
		public static const ${enumConstant.name()}:${clazz.simpleName} = new ${clazz.simpleName}("${enumConstant.name()}"<#if memberFields ??><#list memberFields as field>, ${getEnumFieldValue(clazz, field, enumConstant)}</#list></#if>);
</#list></#if>

<#if memberFields ??><#list memberFields as field><#assign typeName = getActionScriptTypeName(field.type)>
		private var _${field.name}:${typeName};
</#list></#if>

		/*public*/ function ${clazz.simpleName}(name:String=null<#if memberFields ??><#list memberFields as field> ,<#assign typeName = getActionScriptTypeName(field.type)>${field.name}:${typeName}=${getActionScriptTypeDefaultValue(field.type)}</#list></#if>) {
			super.name = name;
<#if memberFields ??><#list memberFields as field>
			this._${field.name} = ${field.name};
</#list></#if>
		}

<#if memberFields ??><#list memberFields as field><#assign typeName = getActionScriptTypeName(field.type)>
		public function get ${field.name}():${typeName}  { return this._${field.name}; }
</#list></#if>

		/* constant query */
		public static function getEnumConstants():Array {
			return Enum.getEnumConstants(${clazz.simpleName});
		}

		public static function get(constantName:String, caseSensitive:Boolean = false):${clazz.simpleName} {
			return ${clazz.simpleName}(Enum.get(${clazz.simpleName}, constantName, caseSensitive));
		}
	}
}